<?php
$lifeTime = 10 * 60;//保存10分钟
session_set_cookie_params($lifeTime);
session_start();//会话开始
?>

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录页面</title>
    <link rel="stylesheet" href="CSS/login.css">
    
</head>
<body id="bd">
    <div class="login">
        <?php if (isset($_SESSION['is login']) && $_SESSION['is login']) : ?>
            <?php header("Location: index.php"); ?>//判断是否登录
        <?php else : ?>
            <?php 
            if(isset($_SESSION['felt']) && $_SESSION['felt']) {
                echo "<script> alert('账号或密码错误'); </script>";//错误提出提示
            }
            ?>         
            <form action="check_login.php" method="post">
                <table>
                    <h1>Login</h1>
                    <ul class="content">
                        <li>
                            <input type="text" placeholder="  用户名" class="username" name="username">
                            <span class="user_name">usename is required</span>
                        </li>
                        <li>
                            <input type="text" placeholder="  账号" class="account" name="account">
                            <span class="user_account">account is required</span>
                        </li>
                        <li>
                            <input type="password" placeholder="  密码" class="password" name="password">
                            <span class="user_password">The password can not be less than 6 digits</span>
                        </li>
                        <li>
                            <input type="submit" id="box" value="立即登录">
                        </li>
                    </ul>
                </table>
            </form>
        <?php endif; ?>
    </div>
</body>
<script src="JS/login.js"></script>
</html>